﻿@model PagedList.IPagedList<VOD.Models.Video>
@using VOD.Helpers;
@{
    ViewBag.Title = "List";
}

<h1>视频列表</h1>
<div class="searchBox">
    @using (Html.BeginForm())
    {
        <p>视频名称：@Html.TextBox("searchString", ViewBag.CurrentString as string)&nbsp;
            <input type="submit" value="搜索" />
        </p>
    }    
</div>

<table>
    <tr class="thead">
        <th width="117">名称</th>
        <th width="164">主演</th>
        <th width="37">年份</th>
        <th width="70">添加时间</th>
        <th width="70">更新时间</th>
        <th width="220">简介</th>
        <th width="46">语言</th>
        <th width="46">分类</th>
        <th width="46">地区</th>
        <th></th>
    </tr>
@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.ActionLink(Html.Truncate(item.Name, 8), "Details", "VideoMgr", new { id = item.VideoID }, new { title = item.Name })
        </td>
        <td title="@item.Actor">
            @Html.Truncate(item.Actor, 14)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ShowYear)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AddDate)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UpdateDate)
        </td>
        <td title="@item.Intro">
            @Html.Truncate(item.Intro, 30)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.VideoLanguage.LangName)
        </td>
        <td>
            @foreach (var type in item.VideoAndTypes)
            {
                @type.VideoType.TypeName @:<br />
            }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.VideoArea.AreaName)
        </td>
        <td>
            @Html.ActionLink("编辑信息", "EditInfo", new { id = item.VideoID }) |
            @Html.ActionLink("查看", "Details", new { id = item.VideoID })<br />
            @Html.ActionLink("添加文件", "EditFiles", new { id = item.VideoID }) |
            @Html.ActionLink("删除", "Delete", new { id = item.VideoID })
        </td>
    </tr>
}

</table>
@*分页*@
@if (Model.PageCount > 1)
{
<div class="paging">
    @if (Model.IsFirstPage)
    {
        @:<a>|<</a>
        @:<a><</a>
    }
    else
    {
        @Html.ActionLink("|<", "NoFile", new { page = 1, currentFilter = ViewBag.CurrentFilter })
        @Html.ActionLink("<", "NoFile", new { page = Model.PageNumber -1 , currentFilter = ViewBag.CurrentFilter })
    }
    @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)/@Model.PageCount
    @if (Model.IsLastPage)
    {
        @:<a>></a>
        @:<a>>|</a>
    }
    else
    {
        @Html.ActionLink(">", "NoFile", new { page = Model.PageNumber + 1, currentFilter = ViewBag.CurrentFilter }) 
        @Html.ActionLink(">|", "NoFile", new { page = Model.PageCount, currentFilter = ViewBag.CurrentFilter })
    }
</div>
}